<%@ include file = "/common/ini.jsp"%>
<%@ include file = "/common/_log4j.jsp"%>
<%@ include file = "/common/_ApplicationContext_init.jsp"%>
<%@ include file = "/common/_vr.jsp"%>
<%@ include file = "/js/_js_for_select.jsp"%>
<%
    // 定义名称
    String title = "修改角色";
    RoleManager roleManager = (RoleManager)applicationContext.getBean("roleManager");
    Role role = (Role)roleManager.get(request.getParameter("id"));
    String remark = "";
%>
<script>
    function submitData()
    {
        if(detailForm.parentId.value == "null")
        {
            detailForm.parentId.disabled = true;
        }
        detailForm.serviceURL.value = "sysframe.role.UpdateRoleService";
        detailForm.submit();
    }
    function reset()
    {
        detailForm.code.disabled = true;
        detailForm.id.value="<%= role.getId()%>";
        detailForm.code.value = "<%= role.getCode()%>";
        <%
        String parentId = null;
        if(vr.isAllValidated())
        {
            if(role.getSuperRole() != null)
            {
                parentId = role.getSuperRole().getId();
                %>addOption(detailForm.parentId,"<%= role.getSuperRole().getId()%>","<%= role.getSuperRole().getName()%>");<%
            }
            %>
            detailForm.code.value = "<%= role.getCode()%>";
            detailForm.parentId.value = "<%= parentId%>";
            detailForm.name.value = "<%= role.getName()%>";
            <%
            remark = role.getRemark();
        }
        else
        {
            %>
            detailForm.code.value = "<%= role.getCode()%>";
            detailForm.parentId.value = "<%= request.getParameter("parentId")%>";
            detailForm.name.value = "<%= request.getParameter("name")%>";
            <%
            remark = request.getParameter("remark");
        }
        %>
    }

    function bodyLoadJS()
    {
        // 被聚焦的控件
        detailForm.name.focus();
    }

    function addSubRole()
    {
        window.location.href = "<%= request.getContextPath()%>/moduleinfor/sysframe/role/addRole.jsp?parentId=<%= role.getId()%>";
    }
</script>
<%@ include file = "/common/detail/_OnForm.jsp"%>
<%@ include file = "_detail.jsp"%>
<%@ include file = "/common/detail/_UnderFom_OnButton.jsp"%>
          <input  type="button" value="提交" afterFocused="" of="true" onclick="submitData()">
          &nbsp;&nbsp;<input  type="button" onclick="addSubRole()" value="添加子角色">
          &nbsp;&nbsp;<input  type="button" onclick="reset()" value="重置">
          &nbsp;&nbsp;<input  type="button" onclick="goback()" value="返回">
<%@ include file = "/common/detail/_UnderFom_underButton.jsp"%>
